package com.dao.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dao.BaseDao;
import com.dao.MvTypeDao;
import com.entity.MvType;

@Repository
public class MvTypeDaoImpl extends BaseDao implements MvTypeDao{

	@Override
	public List<Map<String, Object>> queryMvType() {
		String sql ="select mvTypeId,mvTypeName from mvType";
		return executeQuery(sql, null);
	}

	@Override
	public Map<String, Object> queryMusicTypeId(int mvTypeId) {
		String sql ="select mvTypeId,mvTypeName from mvType where mvTypeId=?";
		Object[] params={mvTypeId};
		return executeQueryMap(sql, params);
	}

	@Override
	public int addMvType(MvType mvType) {
		String sql ="insert into mvType(mvTypeName)values(?)";
		Object[] params={mvType.getMvTypeName()};
		return executeUpdate(sql, params);
	}

	@Override
	public int editMvType(MvType mvType) {
		String sql ="update mvType 	set	mvTypeName=?	where mvTypeId=?";
		Object[] params={mvType.getMvTypeName(),mvType.getMvTypeId()};
		return executeUpdate(sql, params);
	}

	@Override
	public int delMvType(int mvTypeId) {
		String sql ="delete from mvType where mvTypeId=?";
		Object[] params={mvTypeId};
		return executeUpdate(sql, params);
	}

}
